class Page4 extends BaseScreen {
    public constructor() {
        super();
        this.skinName = "resource/eui_skins/Page4Skin.exml";
    }

    private img_1: eui.Image;
    private img_3: eui.Image;
    private img_4: eui.Image;
    private img_5: eui.Image;
    private img_6: eui.Image;
    private img_7: eui.Image;
    private img_8: eui.Image;
    private img_9: eui.Image;
    private img_4_y:number = 0;
    private img_5_y:number = 0;
    private img_6_y:number = 0;
    private img_7_y:number = 0;
    private img_8_y:number = 0;
    private img_9_y:number = 0;
    protected childrenCreated(): void {
        super.childrenCreated();
        this.init_view();
    }

    public init_view() {
        this.img_4_y = this.img_4.y;
        this.img_5_y = this.img_5.y;
        this.img_6_y = this.img_6.y;
        this.img_7_y = this.img_7.y;
        this.img_8_y = this.img_8.y;
        this.img_9_y = this.img_9.y;
        this.resetui();
    }

    public resetui(){

        this.img_1.alpha = 0
        this.img_4.mask = this['mask_4'];
        this.img_5.mask = this['mask_5'];
        this.img_6.mask = this['mask_6'];
        this.img_7.mask = this['mask_7'];
        this.img_8.mask = this['mask_8'];
        this.img_9.mask = this['mask_9'];

        this.img_4.y = this.img_4_y + this.img_4.height;
        this.img_5.y = this.img_5_y + this.img_5.height;
        this.img_6.y = this.img_6_y + this.img_6.height;
        this.img_7.y = this.img_7_y + this.img_7.height;
        this.img_8.y = this.img_8_y + this.img_8.height;
        this.img_9.y = this.img_9_y + this.img_9.height;

        if(this.xx_page){
            this.xx_page.stop();
        }
    }

	public showPage(){
        super.showPage();
        this.resetui();
		egret.Tween.get(this.img_1).to({ alpha:1}, 2000);

        // egret.Tween.get(this.img_3).wait(600).to({ x: 0}, 500, egret.Ease.backOut);
        egret.Tween.get(this.img_4).wait(300).to({ y: this.img_4_y}, 1100, egret.Ease.backOut);
        egret.Tween.get(this.img_5).wait(800).to({ y: this.img_5_y}, 1100, egret.Ease.backOut);
        egret.Tween.get(this.img_6).wait(1300).to({ y: this.img_6_y}, 1100, egret.Ease.backOut);
        egret.Tween.get(this.img_7).wait(1800).to({ y: this.img_7_y}, 1100, egret.Ease.backOut);
        egret.Tween.get(this.img_8).wait(2300).to({ y: this.img_8_y}, 1100, egret.Ease.backOut);
        egret.Tween.get(this.img_9).wait(2800).to({ y: this.img_9_y}, 1100, egret.Ease.backOut);

        if(this.xx_page){
            this.xx_page.start();
        }
	}
}